package gmusic.command;

import gmusic.bo.QueryResultBean;
import gmusic.services.impl.GMusicServicesImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

public class ExecuteQuery implements Command {

	private final static Logger log = Logger.getLogger(ExecuteQuery.class);

	public String execute(HttpServletRequest req) throws Exception {

		String code = req.getParameter("code");
		log.debug("ExecuteQuery... REQ:code=" + code);

		QueryResultBean result = GMusicServicesImpl.getInstance().executeQuery(
				code);

		HttpSession session = req.getSession();
		session.setAttribute("queryResult", result);

		return "/afficherResultQuery.jsp";
	}
}